package com.demo.utils;


import java.util.List;

public class PageBean<T> {
    //总记录数
    private int total;
    //总页数
    private int totalPage;
    //当前页码
    private int pageNum;
    //每页显示的记录数
    private int pageSize;
    //起始索引
    private int startIndex;
    private List<T> pageList;

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getTotalPage() {
        return totalPage = this.total % this.pageSize == 0 ?
                (this.total / this.pageSize) : (this.total/this.pageSize+1);
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getPageNumber() {
        return pageNum;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNum = pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getStartIndex() {
        return startIndex = this.pageSize * (this.pageNum - 1);
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public List<T> getPageList() {
        return pageList;
    }

    public void setPageList(List<T> pageList) {
        this.pageList = pageList;
    }

    public PageBean() {
    }
}
